public class Test {
    public static void main(String[] args) {
        Dog d = new Dog("旺财");
        func(d);
        Cat c = new Cat("小虎");
        func(c);
    }
    public static void func(Animal animal) {//向上转型
        animal.eat();//动态绑定
    }
}
